#! /usr/bin/env python
# -*- coding: utf8 -*-

# Alexandre Coster <acoster@rhrk.uni-kl.de>
# AG DBIS - Technische Universität Kaiserslautern

# mXML: Messy XML Generator
# This application generates a dirty (messy) XML file (with changes
# both on the values and the structure) based on a "clean" input

from zope.interface import Interface, Attribute

if __name__ == "__main__":
    print "You shouldn't be running this file!"
    sys.exit()

# All algorithms are expected to implement this interface.
class IAlgorithm(Interface):
    """
    Interface for mXML algorithms.
    """
    name = Attribute("""String containing the name to be used on the configuration file""")

    def __init__(node):
        """Algorithm constructor."""

    def __call__(string):
        """Applies the algorithm to the string"""

def node_to_dictionary(node):
    """
    Converts an xXML algorithm configuration to a dictionary.
    """
    params = {}

    for i in node.findall("./parameters/*"):
        params[i.tag] = i.text.strip()

    return params
